package com.ys.io.p4对象流;

import java.io.Serializable;

/**
 * 描述: 外层对象
 *      深克隆必须 实现Cloneable接口(是一个空接口)
 *      或者 使用对象流,必须实现Serializable(是一个空接口)  子对象也要实现
 * @author CodeYang
 * @version 2021/1/4 11:13
 */
public class OutObject implements Cloneable, Serializable {

    private String name ;

    private int age;


    private InnerObject innerObject;

    public OutObject() {
    }


    public OutObject(String name, int age, InnerObject innerObject) {
        this.name = name;
        this.age = age;
        this.innerObject = innerObject;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public InnerObject getInnerObject() {
        return innerObject;
    }

    public void setInnerObject(InnerObject innerObject) {
        this.innerObject = innerObject;
    }

    @Override
    public String toString() {
        return "OutObject{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", innerObject=" + innerObject +
                '}';
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
